package com.icbc;

import org.testng.annotations.Test;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ExecuteController {
    @Test
    public void test_execute_multiple_times() throws Exception {
        //从testng.xml中获取全类名
        Class<?> clazz = Class.forName("com.icbc.controller.HelloControllerTest");
        Method testHello = clazz.getMethod("testHello");
        Object obj = clazz.newInstance();
        int times = 3;
        for (int i = 0; i < times; i++) {
            try {
                testHello.invoke(obj);
            } catch (InvocationTargetException e) {
                System.out.println("变异被杀死：" + e.getTargetException().getMessage());
            }
        }
    }
}
